import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

import App from './App.vue'
import router from './router'
import '@/permission'
import { opPermission } from '@/permission'
import * as Icons from '@element-plus/icons-vue'
import * as echarts from 'echarts'

// 导入mockjs，开启本地调试模式
import './mock/index.ts'

const pinia = createPinia()
const app = createApp(App)

// 注册图标
Object.keys(Icons).forEach((key) => {
  app.component(key, Icons[key as keyof typeof Icons])
})

app.use(pinia)
app.use(router)
app.use(ElementPlus)
app.directive('permission', opPermission)

app.config.globalProperties.$echarts = echarts

app.mount('#app')
